﻿@model WebCalendar.Models.DTOs.ManageIndexDTO

@{
    ViewBag.Title = "Manage";
}

<h2>Manage</h2>

<p>
    @Html.ActionLink("Create new calendar...", "Create")
</p>
<p>
    @Html.ActionLink("Create new category...", "CreateCategory")
</p>
<table>
    <tr>
        <th>
            Own calendars
        </th>
        <th></th>
    </tr>
@if (Model.OwnCalendars.Count() != 0){
    foreach (var item in Model.OwnCalendars) {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @Html.ActionLink("Show", "Index","Calendar", new { id=item.ID , year = DateTime.Now.Year, month = DateTime.Now.Month}, null) |
                @Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
                @Html.ActionLink("Roles", "CalendarRoles", new { id = item.ID}) |
                @*@Html.ActionLink("Details", "Details", new { id=item.ID }) |*@
                @Html.ActionLink("Delete", "Delete", new { id=item.ID })
            </td>
        </tr>
    }
}


    <tr>
        <th>
            Editable calendars
        </th>
        <th></th>
    </tr>
@if (Model.EditableCalendars.Count != 0){
    foreach (var item in Model.EditableCalendars) {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @Html.ActionLink("Show", "Index","Calendar", new { id=item.ID , year = DateTime.Now.Year, month = DateTime.Now.Month}, null) |
                @Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
                @*@Html.ActionLink("Details", "Details", new { id=item.ID }) |*@
                @*@Html.ActionLink("Delete", "Delete", new { id=item.ID })*@
            </td>
        </tr>
    }  
}
    <tr>
        <th>
            Viewable calendars
        </th>
        <th></th>
    </tr>
@if (Model.MemberCalendars.Count() != 0)
{
    foreach (var item in Model.MemberCalendars) {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @Html.ActionLink("Show", "Index","Calendar", new { id=item.ID , year = DateTime.Now.Year, month = DateTime.Now.Month}, null)
                @*@Html.ActionLink("Edit", "Edit", new { id=item.ID }) |*@
                @*@Html.ActionLink("Details", "Details", new { id=item.ID }) |*@
                @*@Html.ActionLink("Delete", "Delete", new { id=item.ID })*@
            </td>
        </tr>
    }
}
    
    <tr>
        <th>
            Categories
        </th>
        <th></th>
    </tr>

@if (Model.MyCategories.Count() != 0){
    foreach (var item in Model.MyCategories) {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @Html.ActionLink("Edit", "EditCategory", new { id=item.ID }) |
                @*@Html.ActionLink("Details", "Details", new { id=item.ID }) |*@
                @Html.ActionLink("Delete", "DeleteCategory", new { id=item.ID })
            </td>
        </tr>
    }
}

</table>
